﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Business;

namespace PostSubmit
{
    public partial class 获取属性值转化XML : Form
    {
        public 获取属性值转化XML()
        {
            InitializeComponent();
            
        }

        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog fileDialog = new OpenFileDialog();//判断用户是否正确的选择了文件
            if (fileDialog.ShowDialog() == DialogResult.OK)
            {
                //获取用户选择文件的后缀名
                string extension = Path.GetExtension(fileDialog.FileName);
                //声明允许的后缀名
                string[] str = new string[] { ".cs", ".txt" };
                if (!str.Contains(extension))
                {
                    MessageBox.Show("仅能上传cs格式的图片！");
                }
                else
                {
                    
                    FileStream fs = new FileStream(fileDialog.FileName, FileMode.Open, FileAccess.Read);
                    StreamReader mStreamReader = new StreamReader(fs);
                    mStreamReader.BaseStream.Seek(0, SeekOrigin.Begin);
                    string strLine = mStreamReader.ReadLine();
                    mStreamReader.Close();
                    mStreamReader.Dispose();
                    fs.Close();
                    fs.Dispose();
                    if (strLine != null)
                    {
                        Type t = typeof(DelayAnalysisPnrRequest);

                        System.Reflection.MethodInfo[] methods = t.GetMethods();
                        foreach (System.Reflection.MethodInfo method in methods)
                        {
                            //this.textBox1.Text += method.Name + System.Environment.NewLine;
                        }
                        System.Reflection.MemberInfo[] members = t.GetMembers();
                        System.Reflection.PropertyInfo[] properties = t.GetProperties();
                        foreach (System.Reflection.PropertyInfo property in properties)
                        {
                            //this.lstColors.Items.Add(property.Name);
                            //property.GetCustomAttributes()
                        }
                    }
                }
            }
        }
    }
}
